﻿@model MyCompanyName.AbpZeroTemplate.Daybooks.Dto.GetDaybookForEditOutput
@{
    ViewBag.Title = "Edit";
    ViewBag.CurrentPageName = MyCompanyName.AbpZeroTemplate.Web.Navigation.PageNames.App.Okr.Daybook_Edit;
}
<div class="portlet light bordered">
    <div class="portlet-title">
        <div class="caption">
            <i class="icon-equalizer font-red-sunglo"></i>
            <span class="caption-subject font-red-sunglo bold uppercase">撰写日报</span>
            <span class="caption-helper"> 记录每天的工作状态  OKR | Objectives and Key Results | 目標和主要成果</span>
        </div>
    </div>
    <div class="portlet-body form">
        <!-- BEGIN FORM-->
        <form id="formnew" class="form-horizontal" action="/Okr/Daybook/Edit" method="post">
            @Html.AntiForgeryToken()
            @if (Model.IsEditMode)
            {
                <input type="hidden" name="Id" value="@Model.Book.Id" />
            }
            <div class="form-body">
                @*<h4 class="form-section">@DateTime.Now.ToString("yyyy-MM-dd")</h4>*@

                <div class="row">
                    <div class="col-md-3">
                        <div class="form-group">
                            <label class="control-label col-md-5">填报的日期</label>
                            <div class="col-md-5">
                                <input type="date" class="form-control" placeholder="BookDay" name="BookDay" value="@Model.Book.BookDay.ToString("yyyy-MM-dd")">
                                <span class="help-block">
                                </span>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-3">
                        <div class="form-group">
                            <label class="control-label col-md-5">所属分类</label>
                            <div class="col-md-5">
                                @{var categorys = new List<string>() { "缺勤", "在岗", "出差", "外出", "请假", "休息" };}
                                <select class="form-control" name="Category">
                                    @foreach (var item in @categorys)
                                    {
                                        var _sel = @Model.Book.Category == @item ? "selected=\"selected\"" : "";
                                        <option value="@item"  @_sel>@item</option>
                                    }
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-3">
                        <div class="form-group">
                            <label class="control-label col-md-5">撰写人</label>
                            <div class="col-md-5">
                                <p class="form-control-static">
                                    @User.Identity.Name
                                </p>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-3">
                        <div class="form-group">
                            <label class="control-label col-md-5">撰写时间</label>
                            <div class="col-md-5">
                                <p class="form-control-static">
                                    @DateTime.Now.ToString("yyyy-MM-dd")
                                </p>
                            </div>
                        </div>
                    </div>
                </div>

                @for (int i = 0; i < 10; i++)
                {
                    var info = Model.Items.ElementAt(i);
                    info.Index = i + 1;

                    if (info.Id.HasValue)
                    {
                        <input type="hidden" name="Id_@i" value="@info.Id" />
                    }

                    <div class="form-group">
                        <div class="col-md-5 col-sm-12">
                            <input type="text" class="form-control" placeholder="@info.Index .   事务" name="Work_@i" value="@info.Work">
                        </div>
                        <div class="col-md-1 col-sm-2">
                            @Html.DropDownList("State_" + i,
                                EnumHelper.GetSelectList(typeof(MyCompanyName.AbpZeroTemplate.Daybooks.WorkStatus), info.State),
                                new { @class = "form-control select2me" })
                        </div>
                        <div class="col-md-1 col-sm-2">
                            <input type="text" class="form-control" placeholder="客户" name="Customer_@i" value="@info.Customer">
                        </div>
                        <div class="col-md-1 col-sm-2">
                            <input type="text" class="form-control" placeholder="产品线" name="Product_@i" value="@info.Product">
                        </div>
                        <div class="col-md-1 col-sm-2">
                            <input type="text" class="form-control" placeholder="工时(H)" name="ManHour_@i" value="@info.ManHourDisplay">
                        </div>
                        <div class="col-md-3  col-sm-4">
                            <input type="text" class="form-control" placeholder="备注" name="Remark_@i" value="@info.Remark">
                        </div>
                    </div>
                }


                <div class="clearfix margin-top-10  margin-bottom-10 ">
                    <span class="label label-danger">NOTE!</span> 事务、状态、客户、产品线、工时 皆不能为空，当有一项为空时，该行将不被存储
                </div>

                <div class="form-group">
                    <label class="control-label col-md-1">备注</label>
                    <div class="col-md-11">
                        <textarea class="form-control" name="Remark" placeholder="其它 不方便 在上述表格中登记的事宜">@Model.Book.Remark</textarea>

                    </div>
                </div>

            </div>

            <div class="form-actions">
                <div class="row">
                    <div class="col-md-offset-3 col-md-9">
                        <button type="submit" data-loading-text="提交中..." class="loading-btn btn green">提交</button>
                        <button type="reset" class="btn default">重置</button>

                    </div>
                </div>
            </div>
        </form>
        <!-- END FORM-->
    </div>
</div>